<?php

session_start();
if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
    $targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name'];
    IF (move_uploaded_file($tempFile, $targetFile)) {
        
    } else {
        $_SESSION[upload][erro] = true;
    }
    echo "1";
}
?>